package com.cndatacom.ccsinfoMgr.dao.impl;

import com.cndatacom.ccsinfoMgr.dao.IGatheringInfoDao;
import com.cndatacom.ccsinfoMgr.model.GatheringInfo;
import com.cndatacom.eweb.common.PaginationModel;
import com.cndatacom.eweb.common.PaginationSupport;

public class GatheringInfoDao extends PaginationSupport implements IGatheringInfoDao {

	public boolean delGatheringInfoById(int id) {
		getHibernateTemplate().delete(getGatheringInfoById(id));
		return true;
	}

	public PaginationModel getAllGatheringInfo(int offset, int pageSize) {
		return searchPaginated("select gi from GatheringInfo gi order by gi.id desc", offset, pageSize);
	}

	public GatheringInfo getGatheringInfoById(int id) {
		return (GatheringInfo)getHibernateTemplate().get(GatheringInfo.class, new Integer(id));
	}

	public GatheringInfo saveOrUpdateGatheringInfo(GatheringInfo gInfo) {
		getHibernateTemplate().saveOrUpdate(gInfo);
		return gInfo;

	}

	public PaginationModel getGatheringInfoByHQL(String hql, int offset, int pageSize) {
		return searchPaginated(hql, offset, pageSize);
	}

}

